package com.qdu.group;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

//分组统计
public class GroupMapper extends Mapper<LongWritable, Text, Text, IntWritable> {
    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, IntWritable>.Context context) throws IOException, InterruptedException {
        String[] str = value.toString().split(",");
        if(value.toString().contains("id")){
            return;
        }
        context.write(new Text(str[3]), new IntWritable(Integer.parseInt(str[5])));
    }
}
